﻿using System.ComponentModel;
using Medicalsystem.MCP.FormDesigner.Common;
using Medicalsystem.MCP.FormDesigner.Define;
using Medicalsystem.MCP.FormDesigner.Property;

namespace Medicalsystem.MCP.FormDesigner.MyControls
{
    /// <summary>
    /// 多行文本显示
    /// </summary>
    [ToolboxItem(false)]
    public class MutiLabel : SingleLabel
    {
        public MutiLabel(Model model) : this(model, EDesignModeState.Run) { }

        public MutiLabel(Model model, EDesignModeState designModeState)
            : base(model, designModeState)
        {
            this.AutoSize = false;
        }

        public override EUISizeMode UISizeMode
        {
            get
            {
                return EUISizeMode.AllowBoth;
            }
        }

        public override GetCtrlProperty PropertyObject
        {
            get
            {
                if (this._propertyObject == null)
                {
                    this._propertyObject = new GetMutiLabelProperty(this);
                }

                return this._propertyObject;
            }
        }

        public override string ToXML()
        {
            MutiLabelPropertyXML XML = new MutiLabelPropertyXML(this);
            return XML.ToXML();
        }

        public override void FromXML(System.Xml.XmlNodeList xns)
        {
            if (xns != null && xns.Count > 0)
            {
                MutiLabelPropertyXML XML = new MutiLabelPropertyXML(this);
                XML.FromXML(xns);
            }
        }
    }
}